<template>
  <div class="all">
    <header>
      <div class="div" @click="back">
        <img src="../../assets/返回.png" alt="">
        <span class="solid">返回</span>
      </div>
      <div class="div">
        <span>身份审核</span>
      </div>
      <div class="div">
        <span></span>
      </div>
    </header>
    <div style="height: 25%;display: flex;align-items: flex-end;justify-content: center"><img style="width: 75px;height: 75px;" src="../../assets/审核中.png" alt=""></div>
    <div style="margin-top:10px;height: 25px;display: flex;align-items: center;justify-content: center;color: #1da4f2">审核中</div>
    <div style="height: 25px;display: flex;align-items: center;justify-content: center">{{formatDate(new Date())}}</div>
    <div style="width: 92%;margin: 20px auto;">
      您的认证信息已经提交成功，请耐心等待工作人员审核。我们会在5个工作日反馈审核结果，请及时登录平台APP查看审核进度。
    </div>
    <div style="width: 92%;margin: 0 auto">
      如信息填写有误，可以点击下方按钮重新提交。
    </div>
    <button style="width: 95%;
height: 44px;
margin: 30px 3%;
border: none;
color: #FFFFFF;
font-size: 17px;
font-family: PingFang SC;
font-weight: bold;
color: #FFFFFF;
background: linear-gradient(90deg, #1DA3F2 0%, #1DC7F2 100%);
border-radius: 5px;" @click="again()">重新提交</button>
  </div>
</template>

<script>
import {Toast} from 'vant'

export default {
  name: 'Verification',
  data () {
    return {
      userid: this.$route.query.userid
    }
  },
  mounted () {
    if (this.$route.query.STAFF_ID) {
      this.$http.findOne({STAFF_ID: this.$route.query.STAFF_ID})
        .then(res => {
          console.log(res)
          if (res.data.status === 'success') {
            let data = res.data.data
            let realNameData = new Object()
            realNameData.CareerInfo = {
              STAFF_NAME: data.STAFF_NAME,
              ptDEPART: data.PLATFORM_DEPART, // 平台科室
              MAJOR: data.MAJOR, // 医生职称
              hospital: data.HOSPITAL_NAME, // 医院
              hospitalID: data.HOSPITAL_ID, // 医院对应id
              hosDEPART: data.DEPART, // 医院科室
              Goodat: data.Goodat, // 擅长
              INTRODUCE: data.INTRODUCE, // 介绍
              GRADUATE_SCHOOL: data.GRADUATE_SCHOOL, // 毕业学校
              GRADUATE_DATE: data.GRADUATE_DATE, // 毕业时间
              GRADUATE_CLASS: data.GRADUATE_CLASS // 就读班级
            }
            realNameData.PracticeInfo = {
              zhiYeFileList: [],
              PRACTICE_CERTIFICATE_PIC: [], // 执业证书图片
              zhiChengFileList: [],
              TITLE_CERTIFICATE_PIC: [] // 职称证书图片
            }
            realNameData.realNameInfo = {
              STAFF_NAME: '',
              SEX: '',
              nation: '', // 民族
              BIRTHDAY: '', // 出生年月日
              xiangxiAddress: '', // 详细住址
              shenfenzheng: '', // 身份证号
              jiguan: '', // 签发机关
              qixian: '', // 有效期限
              frontFileList: [],
              reverseFileList: [],
              IDNUM_FRONT_PIC: '', // 身份证正面图片
              IDNUM_BACK_PIC: '' // 身份证反面图片
            }
            // 1 执业证书  2职称证书  3 身份证正面 4身份证反面
            data.Zlist.map((curr, index) => {
              let obj = {
                url: curr.img_url, isImage: true
              }
              if (curr.img_type == 1) {
                realNameData.PracticeInfo.zhiYeFileList.push(obj)
                realNameData.PracticeInfo.PRACTICE_CERTIFICATE_PIC.push(curr.img_url)
              } else if (curr.img_type == 2) {
                realNameData.PracticeInfo.zhiChengFileList.push(obj)
                realNameData.PracticeInfo.TITLE_CERTIFICATE_PIC.push(curr.img_url)
              } else if (curr.img_type == 3) {
                realNameData.realNameInfo.frontFileList.push(obj)
                realNameData.realNameInfo.IDNUM_FRONT_PIC = curr.img_url
              } else if (curr.img_type == 4) {
                realNameData.realNameInfo.reverseFileList.push(obj)
                realNameData.realNameInfo.IDNUM_BACK_PIC = curr.img_url
              }
            })
            sessionStorage.setItem('realNameData', JSON.stringify(realNameData))
          } else {
            Toast(res.data.msg)
          }
        })
        .catch(err => {
          console.log(err)
          Toast('您的网络有些拥挤，请稍后再试')
        })
    }
  },
  methods: {
    back () {
      this.$router.history.go(-1)
      // this.$router.push({path: '/my', query: {userid: this.userid}})
    },
    again () {
      this.$router.push({path: '/CareerInformation', query: {userid: this.userid}})
    },
    formatDate (date) {
      var date = new Date(date)
      var YY = date.getFullYear() + '-'
      var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
      var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate())
      var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
      var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':'
      var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds())
      return YY + MM + DD + ' ' + hh + mm + ss
    }
  }
}
</script>

<style scoped>
.all{
  width: 100%;
  height: 100%;
  background: #FAF9FE;
  overflow: auto;
  font-size: 15px;
  font-family: PingFang SC;
}
header{
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #E5E5E5;
  background: white;
  position: sticky;
  top: 0;
  z-index: 9;
}
.div{
  width: 33%;
  height: 100%;
  display: flex;
  align-items: center;
  font-family: "PingFang SC";
  font-size: 15px;
  font-weight: bold;
}
.div img{
  margin-right: 5px;
}
.div:nth-child(1) img{
  height: 13px;
  width: 7px;
  margin-left: 15px;
}
.div:nth-child(3) img{
  margin-right: 5px;
  width: 13px;
  height: 13px;
}
.div:nth-child(3) span{
  margin-right: 15px;
}
.div:nth-child(2){
  justify-content: center;
}
.div:nth-child(3){
  justify-content: flex-end;
}
.solid{
  color: #1DA4F2;
}
</style>
